package com.xbai.search.controller;

import com.xbai.entity.Result;
import com.xbai.search.service.SkuService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author jxbai
 * @desc
 * @date 2021/2/1
 */
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/search")
@CrossOrigin
public class SkuController {

    private final SkuService skuService;

    @GetMapping
    public Map search(@RequestParam(required = false) Map searchMap) {
        return  skuService.search(searchMap);
    }


    @GetMapping("/import")
    public Result search() {
        skuService.importSku();
        return new Result("导入数据到索引库中成功！");
    }
}
